﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Wandering
{
    public partial class Thes : Form
    {
        public Thes()
        {
            InitializeComponent();
        }
        //确定
        private void button1_Click(object sender, EventArgs e)
        {
            var title = txtUid.Text;
            var author = txtPwd.Text;
            var time = DateTime.Now;

            string sql = string.Format("insert into Articles(Title,Author,CreatedTime) values('{0}','{1}','{2}')", title, author, time);

            var res=DBHelper.InsertOrDeleteOrUpdate(sql);

            if (res >= 1)
            {
                MessageBox.Show("添加成功");
                this.Close();
            }
            else
            {
                MessageBox.Show("添加失败");
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
